<?php
class ModelAccountCustomerGroup extends Model {
	public function getCustomerGroup($user_group_id) {
    $query = $this->db->query("SELECT DISTINCT * FROM " . $this->db_prefix . "customer_group cg 
      LEFT JOIN " . $this->db_prefix . "customer_group_description cgd 
      ON (cg.user_group_id = cgd.user_group_id) 
      WHERE cg.user_group_id = '" . (int)$user_group_id . "' 
      AND cgd.language_id = '" . (int)$this->setting->get('setting_language_id') . "'");
		
		return $query->row;
	}
	
	public function getCustomerGroups() {
    $query = $this->db->query("SELECT * FROM " . $this->db_prefix . "customer_group cg 
      LEFT JOIN " . $this->db_prefix . "customer_group_description cgd 
      ON (cg.user_group_id = cgd.user_group_id) 
      WHERE cgd.language_id = '" . (int)$this->setting->get('setting_language_id') . "' 
      ORDER BY cg.sort_order ASC, cgd.name ASC");
		
		return $query->rows;
	}
}
?>
